﻿package com.jxl.dnd.feats
{
	public class Feat
	{
		public var name:String;
		public var type:String;
		public var requirements_array:Array;
		public var description:String;
		
		public function Feat(name:String, type:String, requirements_array:Array, description:String):void
		{
			this.name 							= name;
			this.type 							= type;
			this.requirements_array 			= requirements_array;
			this.description					= description;
		}
		
		public function toXML():XML
		{
			var featXML:XML = 
				<feat>
					<name>{name}</name>
					<type>{type}</type>
					<requirements>{requirements_array.join(",")}</requirements>
					<description>{description}</description>
				</feat>;
			return featXML;
		}
		
		public function buildFromXML(xml:XML):void
		{
			name							= String(xml.name);
			type							= String(xml.type);
			requirements_array				= String(xml.requirements).split(",");
			description						= String(xml.description);
		}
	}
}